package org.gavin.core.exception;

import org.gavin.core.domain.Status;

/**
 * SafetyException
 *
 * @author grl
 * @date 2024/1/17
 */
public class SafetyException extends BaseException{

    public SafetyException(String module, Integer code, Object args, String msg) {
        super(module,code,args,"module "+ module + msg + " 应实现SafetyAbstract接口 类型type 为 "+ args);
    }

    public static SafetyException le(String module, Integer code, Object args, String msg){
        return new SafetyException(module,code,args,msg);
    }

    public static <T extends Status> SafetyException le(T status, String module, Object args ){
        return new SafetyException(module,status.getCode(),args,status.getMsg());
    }

    public static <T extends Status> SafetyException le(T status){
        return new SafetyException(null,status.getCode(),null,status.getMsg());
    }
}
